<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" %>
<%@include file="/quick/include/common.jsp"%>
<c:set var="buttons">
    
    <input type="button" style="margin-right: 5px"   onclick="f_add()" value="<fmt:message key="button.add"/>"/>
    <input type="button" style="margin-right: 5px"   onclick="f_delete()" value="<fmt:message key="button.delete"/>"/>
    <input type="button" style="margin-right: 5px"   onclick="f_cancel()" value="<fmt:message key="button.cancel"/>"/>
    <input type="button" style="margin-right: 5px"   onclick="f_save()" value="<fmt:message key="button.save"/>"/>
    <input type="button" style="margin-right: 5px"   onclick="f_query()" value="<fmt:message key="button.query"/>"/>
    <input type="button" style="margin-right: 5px"   onclick="f_load()" value="<fmt:message key="button.load.reexam.students"/>"/>
    <input type="button" style="margin-right: 5px"   onclick="f_excel()" value="<fmt:message key="button.excel"/>"/>
<c:if test='${not empty model.parentId}'>
    <input type="button" style="margin-right: 5px"   onclick="f_back()" value="<fmt:message key="button.back"/>"/>
</c:if>
</c:set>
<div id='toolbar' style="display:none">
<c:out value="${buttons}" escapeXml="false"/>
</div>
<script>
var reexamYear="<c:out value='${parameter.SCHOOL_YEAR}'/>";
var reexamSemester="<c:out value='${parameter.SCHOOL_SEMESTER}'/>";
Ext.onReady(globalScope._ready);
 
function f_excel(tableName){
  globalScope._exportExcel(tableName,{SCHOOL_YEAR:reexamYear,SCHOOL_SEMESTER:reexamSemester});
//  globalScope._excel();
}


<c:if test='${not empty model.parentId}'>
function f_back(){
   globalScope._back();
}
</c:if>

function f_load(){
   Ext.get(document.body).mask('<fmt:message key="info.saveMsg"/>');
  Ext.Ajax.request({
    method:'POST',
    url:g_rootPath+'educational/reexam/loadReexamStudents.html',
    params:{'reexamYear':reexamYear,'reexamSemester':reexamSemester},
    success:function(response){
      Ext.get(document.body).unmask();
  	   var resp=Ext.decode(response.responseText);
  	   if(resp.success==false){
  	     Ext.Msg.alert('警告','导入出错:'+resp.errorInfo);
  	     return;
  	   }  
  	   alert(resp.info);
  	   location.reload();
    },
    failure:function(response){
      Ext.get(document.body).unmask();
      alert("导入补考学生失败!");
    }
  });
}

function f_add(tableName){
  globalScope._add(tableName);
}


function f_delete(tableName){
  globalScope._delete(tableName);
} 

function f_cancel(tableName){
  globalScope._cancel(tableName);
}

function f_save(tableName,url){
  globalScope._save(tableName,url);
}

function f_query(tableName){
    globalScope._query(tableName);
}
function f_gotoPage(pageNo,rowsOfPage,pageCount,rowCount,condition){
  globalScope._gotoPage({spanName:"g_pageSpan_<c:out value='${model.tableName}'/>",pageNo:pageNo,rowsOfPage:rowsOfPage,pageCount:pageCount,rowCount:rowCount,condition:condition,tableName:"<c:out value='${model.tableName}'/>"},{SCHOOL_YEAR:reexamYear,SCHOOL_SEMESTER:reexamSemester});
}
</script>
